//package com.baixun.gasadmin.controller;
//
//import com.baixun.gascommon.utils.R;
//import com.baixun.gasentity.dto.AlarmDTO;
//import com.baixun.gasentity.dto.VideoDto;
//import com.baixun.gasentity.entity.SysVideoMessage;
//import com.baixun.gasentity.vo.AbnormalPointVo;
//import com.baixun.gasentity.vo.VideoPlaybackVO;
//import com.baixun.gassystem.service.AbnormalPointService;
//import com.baixun.gassystem.service.AlarmService;
//import com.baixun.gassystem.service.SysVideoMessageService;
//import com.baixun.gassystem.service.VideoPlaybackService;
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.format.annotation.DateTimeFormat;
//import org.springframework.security.access.prepost.PreAuthorize;
//import org.springframework.web.bind.annotation.*;
//
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.time.LocalDateTime;
//import java.util.List;
//
///**
// * @program: 上海燃气驾驶舱
// * @description: 执法仪控制层
// * @author: yesong
// **/
//@RestController
//@RequestMapping("/fa")
//@Api(tags = "执法仪模块")
//public class FaController {
//
//    @Autowired
//    private AlarmService alarmService;
//
//    @Autowired
//    private VideoPlaybackService videoPlaybackService;
//
//    @Autowired
//    public SysVideoMessageService sysVideoMessageService;
//
//    @Autowired
//    private AbnormalPointService abnormalPointService;
//
//
//
//    @ApiOperation(value = "获取执法仪类型列表", notes = "根据时间范围和筛选条件获取报警类型列表")
//    @GetMapping("/fa-type")
//    @PreAuthorize("hasAuthority('VIEW_Fa')")
//    public R<AlarmDTO> getFaTypeList(AlarmDTO requestDTO) {
//        IPage<AlarmDTO> alarmDTOIPage = alarmService.selectFaList(requestDTO);
//        return R.ok(alarmDTOIPage);
//    }
//
//    @ApiOperation(value = "导出执法仪列表为 Excel 文件", notes = " Excel 文件")
//    @PostMapping("/exportFa")
//    @PreAuthorize("hasAuthority('VIEW_Fa')")
//    public void exportFaList(AlarmDTO requestDTO, HttpServletResponse response) throws IOException {
//
//        response.setContentType("application/Fa.ms-excel");
//        response.setHeader("Content-Disposition", "attachment; filename=Fa.xlsx");
//        alarmService.exportFaToExcel(response.getOutputStream(), requestDTO);
//    }
//
//    @PreAuthorize("hasAuthority('VIEW_Fa')")
//    @ApiOperation(value = "获取报警统计数据", notes = "获取报警统计数据")
//    @GetMapping("/statistics")
//    public R<AlarmDTO> getAlarmStatistics() {
//        return R.ok((IPage<AlarmDTO>) alarmService.getFaStatistics());
//    }
//
//    @PreAuthorize("hasAuthority('VIEW_Fa')")
//    @ApiOperation(value = "获取报警趋势数据", notes = "获取报警趋势数据")
//    @GetMapping("/trend")
//    public R<AlarmDTO> getAlarmTrend(String startTime, String endTime) {
//        return R.success((AlarmDTO) alarmService.getFaTrend(startTime, endTime));
//    }
//
//    /**
//     * 获取视频播放链接
//     * 根据监控点位ID、协议类型和时间范围，获取对应的视频播放链接
//     *
//     * @param pointId  监控点位 ID
//     * @param protocol 协议类型
//     * @param page     当前页码，默认为1
//     * @param size     每页显示数量，默认为4
//     * @return 返回包含视频播放链接列表的响应对象
//     */
//
////    @PreAuthorize("hasAuthority('VIEW_Fa')")
////    @ApiOperation(value = "视频监控", notes = "根据监控点位ID、协议类型和时间范围，获取对应的视频播放链接")
////    @GetMapping("/getPlaybackLinks")
////    public R<List<VideoPlaybackVO>> getPlaybackLinks(
////            @ApiParam(value = "监控点位 ID", required = true) @RequestParam Long pointId,
////            @ApiParam(value = "协议类型", required = true) @RequestParam String protocol,
////            @ApiParam(value = "当前页码", required = false, defaultValue = "1") @RequestParam(value = "page", required = false) Integer page,
////            @ApiParam(value = "每页显示数量", required = false, defaultValue = "9") @RequestParam(value = "size", required = false) Integer size
////    ) throws Exception {
////        // 调用业务层服务获取视频播放链接列表
////        List<VideoPlaybackVO> playbackLinks = (List<VideoPlaybackVO>) videoPlaybackService.getVideoPlaybackByPointAndProtocol(page, size, pointId, protocol);
////
////
////        // 返回包含视频播放链接列表的响应对象
////        return R.ok((IPage<List<VideoPlaybackVO>>) playbackLinks);
////    }
//
//    /**
//     * 查询视频播放记录
//     * 根据监控点位ID和时间查询视频播放记录
//     *
//     * @param pointId  监控点位 ID
//     * @param date     查询时间
//     * @param page     当前页码，默认值为1
//     * @param size     每页显示数量，默认值为4
//     * @param protocol 协议类型
//     * @return 返回分页查询结果
//     */
//
//    @PreAuthorize("hasAuthority('VIEW_Fa')")
//    @ApiOperation(value = "执法仪监控", notes = "根据监控点位ID和时间查询视频播放记录")
//    @GetMapping("/playback/by-date")
//    public R<VideoPlaybackVO> getPlaybackByDate(
//            @ApiParam(value = "监控点位 ID", required = true) @RequestParam Long pointId,
//            @ApiParam(value = "查询时间", required = true) @RequestParam @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime date,
//            @ApiParam(value = "当前页码", required = false, defaultValue = "1") @RequestParam(value = "page", required = false) Integer page,
//            @ApiParam(value = "每页显示数量", required = false, defaultValue = "9") @RequestParam(value = "size", required = false) Integer size,
//            @ApiParam(value = "协议类型", required = true) @RequestParam String protocol
//    ) {
//        // 调用业务层方法进行分页查询
//        IPage<VideoPlaybackVO> playbackPage = videoPlaybackService.selectPlaybackByDate(pointId, date, page, size, protocol);
//
//        // 返回分页结果
//        return R.ok(playbackPage);
//    }
//
//    @PreAuthorize("hasAuthority('VIEW_VIDEO_MONITOR')")
//    @ApiOperation(value = "获取执法仪异常点位", notes = "根据标签获取执法仪异常点位信息")
//    @GetMapping("/getFa")
//    public R<List<AbnormalPointVo>> getFa() {
//        List<AbnormalPointVo> result = abnormalPointService.getFa();
//        return R.success(result);
//    }
//
//
//
//
//
//
//
//}
